# docker build -t registry.lazycat.cloud/appdb/listpal:202305151730 .
FROM php:7.3.33-apache

RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
    && sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list \
    && requirements="vim cron mariadb-client libwebp-dev libxpm-dev libmcrypt-dev libmcrypt4 libcurl3-dev libxml2-dev \
libmemcached-dev zlib1g-dev libc6 libstdc++6 libkrb5-3 openssl debconf libfreetype6-dev libjpeg-dev libtiff-dev \
libpng-dev git libmagickwand-dev ghostscript gsfonts libbz2-dev libonig-dev libzip-dev zip unzip" \
    && apt-get update && apt-get install -y --no-install-recommends $requirements && apt-get clean && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-install mysqli \
                              pdo_mysql \
                              gd  \
                              exif \
                              bcmath \
                              opcache \
    && docker-php-ext-enable opcache

RUN a2enmod headers && \
    a2enmod rewrite

RUN apt-get update && apt-get install -y --no-install-recommends sqlite3 && apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Composer
# RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# COPY --from=composer /usr/bin/composer /usr/bin/composer

# Add configuration files
COPY image-files/ /
RUN chmod 700 \
        /usr/local/bin/docker-entrypoint.sh

WORKDIR /srv

ENV TIMEZONE=Asia/Shanghai
ENV MYSQL_HOST=localhost
ENV MYSQL_PORT=3306
ENV MYSQL_USER=root
ENV MYSQL_PASSWORD=root
ENV MYSQL_DATABASE=test
ENV TABLE_PREFIX=sd_

EXPOSE 80

COPY . /srv/
RUN chmod -R 777 /srv/storage/

ENTRYPOINT ["docker-entrypoint.sh"]

CMD ["apache2-foreground"]
# CMD ["php artisan serve"]
# CMD ["php artisan websockets:serve"]